<template>
  <d2-container>
    <el-card shadow="never" class="d2-mb titleline">
      <template slot="header" style="height:66px;">
        <span class="title_x el-button--primary fl"></span>
        <p class="title_l fl">已审事项</p>
      </template>
      <el-form
        class="filter-container"
        ref="egForm"
        :model="egForm"
        label-width="70px"
      >
        <el-row :gutter="20">
          <el-col :span="8">
            <el-form-item label="日期">
              <el-col :span="11">
                <el-date-picker
                  type="date"
                  v-model="dataform.startDate"
                  value-format="yyyy-MM-dd"
                  style="width: 100%;"
                ></el-date-picker>
              </el-col>
              <el-col class="line tc" :span="2">~</el-col>
              <el-col :span="11">
                <el-date-picker
                  type="date"
                  v-model="dataform.endDate"
                  value-format="yyyy-MM-dd"
                  style="width: 100%;"
                ></el-date-picker>
              </el-col>
            </el-form-item>
          </el-col>
          <el-col :span="4">
            <el-form-item label="发起人">
              <el-select v-model="dataform.creator">
                <el-option
                  v-for="item in userData"
                  :key="item.id"
                  :label="item.name"
                  :value="item.id"
                >
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="4">
            <el-form-item label="审批状态">
              <el-select v-model="dataform.result">
                <el-option
                  v-for="item in status_data"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value"
                >
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="6" style="margin-top:4px;">
            <el-button type="primary" size="mini" @click="chaxun_fn()">
              <d2-icon name="search" /> 查询
            </el-button>
            <el-button type="primary" size="mini" @click="handleEdit_sp()">
              查询详情
            </el-button>
          </el-col>
        </el-row>
      </el-form>
      <el-table
        ref="multipleriskTj"
        :data="riskTjListData"
        highlight-current-row
        border
        fit
        @current-change="handleCurrentshclChange"
        style="width: 100%;margin-top:20px;"
        :cell-style="{ 'text-align': 'center' }"
        :header-cell-style="{
          background: '#eef1f6',
          'text-align': 'center',
          color: '#606266'
        }"
      >
        <el-table-column label="发起日期" prop="created_time" sortable>
          <template slot-scope="scope">{{
            scope.row.created_time | dateYMDHMSFormat_ss
          }}</template>
        </el-table-column>
        <el-table-column label="发送人" prop="creator.name"> </el-table-column>
        <el-table-column label="已审任务" prop="order.task.name">
        </el-table-column>
        <el-table-column label="审批单据" prop="order.business_id">
        </el-table-column>
        <el-table-column label="审批状态" prop="result"> </el-table-column>
        <el-table-column prop="opinion" label="说明"> </el-table-column>
      </el-table>
      <el-pagination
        @current-change="handlePaginationChange"
        :current-page="dataform.p"
        :page-size="dataform.pageSize"
        layout="total, prev, pager, next"
        :total="dataform.count"
      >
      </el-pagination>
    </el-card>
    <el-dialog
      title="审批详情"
      width="85%"
      :visible.sync="handleFilter_editspclVisible"
      @closed="guanbi"
    >
      <el-card shadow="never" class="d2-mb titleline">
        <template slot="header" style="height:66px;">
          <span class="title_x el-button--primary fl"></span>
          <p class="title_l fl">审批信息</p>
        </template>
        <el-form
          class="filter-container"
          ref="form_header"
          :model="form_header"
          label-width="70px"
        >
          <el-row :gutter="20">
            <el-col :span="5">
              <el-form-item label="发起时间">
                <el-input v-model="onecreated_time" disabled></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="5">
              <el-form-item label="发起人">
                <el-input
                  v-model="form_header.creator.name"
                  disabled
                ></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="5">
              <el-form-item label="审批任务">
                <el-input
                  v-model="form_header.order.task.name"
                  disabled
                ></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="5">
              <el-form-item label="审批单据">
                <el-input
                  v-model="form_header.order.business_id"
                  disabled
                ></el-input>
              </el-form-item>
            </el-col>
          </el-row>
        </el-form>
      </el-card>
      <el-card shadow="never" class="d2-mb titleline">
        <template slot="header" style="height:66px;">
          <span class="title_x el-button--primary fl"></span>
          <p class="title_l fl">审批内容</p>
        </template>
        <div v-if="bol == 5">
          <el-form
            class="filter-container"
            ref="form_header"
            :model="form_header"
            label-width="110px"
          >
            <el-row :gutter="20">
              <el-col :span="5">
                <el-form-item label="部门名称">
                  <el-input
                    v-model="form_header.order.desc.depart_name"
                    disabled
                  ></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="5">
                <el-form-item label="策略名称">
                  <el-input
                    v-model="form_header.order.desc.strategy_name"
                    disabled
                  ></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="5">
                <el-form-item label="策略ID">
                  <el-input
                    v-model="form_header.order.desc.strategy_id"
                    disabled
                  ></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="5">
                <el-form-item label="策略类型">
                  <el-input
                    v-model="form_header.order.desc.strategy_type"
                    disabled
                  ></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="5">
                <el-form-item label="策略目的">
                  <el-input
                    v-model="form_header.order.desc.strategy_objective"
                    disabled
                  ></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="5">
                <el-form-item label="最大占用资金">
                  <el-input
                    v-model="form_header.order.desc.max_occupation_funds"
                    disabled
                  ></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="5">
                <el-form-item label="损失限额">
                  <el-input
                    v-model="form_header.order.desc.loss_limit"
                    disabled
                  ></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="5">
                <el-form-item label="预期盈利">
                  <el-input
                    v-model="form_header.order.desc.profit_expectation"
                    disabled
                  ></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="5">
                <el-form-item label="风险利润比">
                  <el-input
                    v-model="form_header.order.desc.risk_profit_ratio"
                    disabled
                  ></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="5">
                <el-form-item label="预期投资回报率">
                  <el-input
                    v-model="
                      form_header.order.desc.expected_return_on_investment
                    "
                    disabled
                  ></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="5">
                <el-form-item label="策略开始日期">
                  <el-input
                    v-model="form_header.order.desc.strategy_start_date"
                    disabled
                  ></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="5">
                <el-form-item label="策略结束日期">
                  <el-input
                    v-model="form_header.order.desc.strategy_end_date"
                    disabled
                  ></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="5">
                <el-form-item label="策略层级">
                  <el-input
                    v-model="form_header.order.desc.strategy_hierarchy"
                    disabled
                  ></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="5">
                <el-form-item label="策略描述">
                  <el-input
                    v-model="form_header.order.desc.strategy_description"
                    disabled
                  ></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="2" style="margin-top:4px;">
                <el-button
                  type="primary"
                  size="small"
                  @click="
                    $router.push('/examine_historyss?id=' + form_header.id)
                  "
                >
                  <i class="fa fa-calendar-plus-o" aria-hidden="true"></i>
                  审批历史
                </el-button>
              </el-col>
            </el-row>
          </el-form>
          <div>
            <!-- <div v-show="SLGhide"> -->
            <div v-show="xianhuoData.length != 0">
              <p>现货</p>
              <el-table
                ref="xianhuoData"
                :data="xianhuoData"
                border
                style="width: 100%"
              >
                <el-table-column label="品名" prop="name.name">
                </el-table-column>
                <el-table-column label="方向" prop="direction">
                </el-table-column>
                <el-table-column label="参考价格" prop="reference_price">
                </el-table-column>
                <el-table-column label="最大数量" prop="max_amount">
                </el-table-column>
                <el-table-column label="单位" prop="commodity_unit">
                </el-table-column>
                <el-table-column label="币种" prop="currency">
                </el-table-column>
                <el-table-column label="备注" prop="remarks"> </el-table-column>
              </el-table>
            </div>
            <div v-show="qihuoData.length != 0">
              <p>期货</p>
              <el-table
                ref="qihuoData"
                :data="qihuoData"
                border
                style="width: 100%"
              >
                <el-table-column label="品名" prop="productName">
                </el-table-column>
                <el-table-column label="合约" prop="instrument">
                </el-table-column>
                <el-table-column label="方向" prop="direction">
                </el-table-column>
                <el-table-column label="开平" prop="offset_flag">
                </el-table-column>
                <el-table-column
                  v-if="qiquanStats == 0"
                  label="参考价格"
                  prop="reference_price"
                >
                </el-table-column>
                <el-table-column
                  v-if="qiquanStats == 1"
                  label="权利金收支"
                  prop="premium_received_paid"
                >
                </el-table-column>
                <el-table-column label="最大手数" prop="max_volume">
                </el-table-column>
                <el-table-column label="最大数量" prop="max_amount">
                </el-table-column>
                <el-table-column label="单位" prop="commodity_unit">
                </el-table-column>
              </el-table>
            </div>
          </div>
        </div>
        <div v-if="bol == 3">
          <el-form
            class="filter-container"
            ref="form_header"
            :model="form_header"
            label-width="100px"
          >
            <el-row :gutter="20">
              <el-col :span="5">
                <el-form-item label="部门名称">
                  <el-input
                    v-model="form_header.order.desc.department_name"
                    disabled
                  ></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="5">
                <el-form-item label="单据ID">
                  <el-input
                    v-model="form_header.order.desc.invoices_no"
                    disabled
                  ></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="5">
                <el-form-item label="单据日期">
                  <el-input
                    v-model="form_header.order.desc.date"
                    disabled
                  ></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="5">
                <el-form-item label="购销类型">
                  <el-input
                    v-model="form_header.order.desc.direction_name"
                    disabled
                  ></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="5">
                <el-form-item label="客商">
                  <el-input
                    v-model="form_header.order.desc.customer_name"
                    disabled
                  ></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="5">
                <el-form-item label="原币币种">
                  <el-input
                    v-model="form_header.order.desc.currency_name"
                    disabled
                  ></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="5">
                <el-form-item label="原币金额">
                  <el-input
                    v-model="form_header.order.desc.original_price"
                    disabled
                  ></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="5">
                <el-form-item label="汇率">
                  <el-input
                    v-model="form_header.order.desc.exchange_rate"
                    disabled
                  ></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="5">
                <el-form-item label="本币金额">
                  <el-input
                    v-model="form_header.order.desc.currency_price"
                    disabled
                  ></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="5">
                <el-form-item label="费用类型">
                  <el-input
                    v-model="form_header.order.desc.cap_type_all"
                    disabled
                  ></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="5">
                <el-form-item label="已匹配金额">
                  <el-input
                    v-model="form_header.order.desc.matched_price"
                    disabled
                  ></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="5">
                <el-form-item label="未匹配金额">
                  <el-input
                    v-model="form_header.order.desc.unmatched_price"
                    disabled
                  ></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="2" style="margin-top:4px;">
                <el-button
                  type="primary"
                  size="small"
                  @click="
                    $router.push('/examine_historyss?id=' + form_header.id)
                  "
                >
                  <i class="fa fa-calendar-plus-o" aria-hidden="true"></i>
                  审批历史
                </el-button>
              </el-col>
            </el-row>
          </el-form>
          <div style="margin-top:15px">
            <el-table
              ref="xhfyData"
              :data="xhfyData"
              border
              style="width: 100%"
            >
              <el-table-column label="费用类型" prop="cap_type_name">
              </el-table-column>
              <el-table-column label="敞口号" prop="exposure">
              </el-table-column>
              <el-table-column label="敞口数量" prop="exp_vol">
              </el-table-column>
              <el-table-column label="匹配金额" prop="alloc_amount">
              </el-table-column>
              <el-table-column label="备注" prop="remark"> </el-table-column>
            </el-table>
          </div>
        </div>
        <div v-if="bol == 2">
          <el-form
            class="filter-container"
            ref="form_header"
            :model="form_header"
            label-width="100px"
          >
            <el-row :gutter="20">
              <el-col :span="5">
                <el-form-item label="部门名称">
                  <el-input
                    v-model="form_header.order.desc.depart_name"
                    disabled
                  ></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="5">
                <el-form-item label="策略名称">
                  <el-input
                    v-model="form_header.order.desc.strategy_name"
                    disabled
                  ></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="5">
                <el-form-item label="策略ID">
                  <el-input
                    v-model="form_header.order.desc.strategy_id"
                    disabled
                  ></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="5">
                <el-form-item label="指令类型">
                  <el-input
                    v-model="form_header.order.desc.command_type"
                    disabled
                  ></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="5">
                <el-form-item label="指令名称">
                  <el-input
                    v-model="form_header.order.desc.command_name"
                    disabled
                  ></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="5">
                <el-form-item label="指令ID">
                  <el-input
                    v-model="form_header.order.desc.command_id"
                    disabled
                  ></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="5">
                <el-form-item label="柜台账户">
                  <el-input
                    v-model="form_header.order.desc.real_account"
                    disabled
                  ></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="5">
                <el-form-item label="子账户">
                  <el-input
                    v-model="form_header.order.desc.sub_account"
                    disabled
                  ></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="5">
                <el-form-item label="交易员">
                  <el-input
                    v-model="form_header.order.desc.trader"
                    disabled
                  ></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="5">
                <el-form-item label="指令开始日期">
                  <el-input
                    v-model="form_header.order.desc.start_date"
                    disabled
                  ></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="5">
                <el-form-item label="指令结束日期">
                  <el-input
                    v-model="form_header.order.desc.end_date"
                    disabled
                  ></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="2" style="margin-top:4px;">
                <el-button
                  type="primary"
                  size="small"
                  @click="
                    $router.push('/examine_historyss?id=' + form_header.id)
                  "
                >
                  <i class="fa fa-calendar-plus-o" aria-hidden="true"></i>
                  审批历史
                </el-button>
              </el-col>
            </el-row>
          </el-form>
          <div>
            <el-table
              ref="xianhuoData"
              :data="zhioneData"
              border
              style="width: 100%"
            >
              <el-table-column label="策略名称" prop="strategy_name">
              </el-table-column>
              <el-table-column label="策略ID" prop="strategy_id">
              </el-table-column>
              <el-table-column label="指令类型" prop="command_type">
              </el-table-column>
              <el-table-column label="指令名称" prop="command_name">
              </el-table-column>
              <el-table-column label="指令ID" prop="command_id">
              </el-table-column>
              <el-table-column label="指令开始时间" prop="start_date">
                <template slot-scope="scope">{{
                  scope.row.start_date | dateYMDHMSFormat
                }}</template>
              </el-table-column>
              <el-table-column label="指令结束时间" prop="end_date">
                <template slot-scope="scope">{{
                  scope.row.end_date | dateYMDHMSFormat
                }}</template>
              </el-table-column>
              <el-table-column label="部门名称" prop="depart_name">
              </el-table-column>
              <el-table-column label="柜台账号" prop="real_account">
              </el-table-column>
              <el-table-column label="子帐号" prop="sub_account">
              </el-table-column>
              <el-table-column label="交易员" prop="trader"> </el-table-column>
            </el-table>
            <el-table
              ref="qihuoData"
              :data="zhitwoData"
              border
              style="width: 100%;margin-top:10px"
            >
              <el-table-column label="品名" prop="productName">
              </el-table-column>
              <el-table-column label="合约" prop="instrument">
              </el-table-column>
              <el-table-column label="方向" prop="direction"> </el-table-column>
              <el-table-column label="开平" prop="offset_flag">
              </el-table-column>
              <el-table-column label="手数" prop="matchable_volume">
              </el-table-column>
              <el-table-column label="成交区间">
                <template slot-scope="scope">
                  {{ scope.row.min_price }}-{{ scope.row.max_price }}
                </template>
              </el-table-column>
              <el-table-column label="单位" prop="commodity_unit">
              </el-table-column>
              <el-table-column label="币种" prop="currency"> </el-table-column>
            </el-table>
          </div>
        </div>
        <div v-if="bol == 1">
          <el-form
            class="filter-container"
            ref="form_header"
            :model="form_header"
            label-width="100px"
          >
            <el-row :gutter="20">
              <el-col :span="5">
                <el-form-item label="部门名称">
                  <el-input
                    v-model="form_header.order.desc.department_name"
                    disabled
                  ></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="5">
                <el-form-item label="单据ID">
                  <el-input
                    v-model="form_header.order.desc.invoices_no"
                    disabled
                  ></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="5">
                <el-form-item label="单据日期">
                  <el-input
                    v-model="form_header.order.desc.date"
                    disabled
                  ></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="5">
                <el-form-item label="原币币种">
                  <el-input
                    v-model="form_header.order.desc.currency_name"
                    disabled
                  ></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="5">
                <el-form-item label="原币金额">
                  <el-input
                    v-model="form_header.order.desc.original_price"
                    disabled
                  ></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="5">
                <el-form-item label="汇率">
                  <el-input
                    v-model="form_header.order.desc.exchange_rate"
                    disabled
                  ></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="5">
                <el-form-item label="本币金额">
                  <el-input
                    v-model="form_header.order.desc.currency_price"
                    disabled
                  ></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="5">
                <el-form-item label="已匹配金额">
                  <el-input
                    v-model="form_header.order.desc.matched_price"
                    disabled
                  ></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="5">
                <el-form-item label="未匹配金额">
                  <el-input
                    v-model="form_header.order.desc.unmatched_price"
                    disabled
                  ></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="2" style="margin-top:4px;">
                <el-button
                  type="primary"
                  size="small"
                  @click="
                    $router.push('/examine_historyss?id=' + form_header.id)
                  "
                >
                  <i class="fa fa-calendar-plus-o" aria-hidden="true"></i>
                  审批历史
                </el-button>
              </el-col>
            </el-row>
          </el-form>
          <div>
            <el-table ref="yspData" :data="yspData" border style="width: 100%">
              <el-table-column label="费用类型" prop="cap_type_name">
              </el-table-column>
              <el-table-column label="策略名称" prop="strategy_name">
              </el-table-column>
              <el-table-column label="匹配金额" prop="alloc_amount">
              </el-table-column>
              <el-table-column label="备注" prop="remark"> </el-table-column>
            </el-table>
          </div>
        </div>
        <div v-if="bol == 4">
          <el-form
            class="filter-container"
            ref="form_header"
            :model="form_header"
            label-width="100px"
          >
            <el-row :gutter="20">
              <el-col :span="5">
                <el-form-item label="部门名称">
                  <el-input
                    v-model="form_header.order.desc.department_name"
                    disabled
                  ></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="5">
                <el-form-item label="单据ID">
                  <el-input
                    v-model="form_header.order.desc.invoices_no"
                    disabled
                  ></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="5">
                <el-form-item label="单据日期">
                  <el-input
                    v-model="form_header.order.desc.date"
                    disabled
                  ></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="5">
                <el-form-item label="购销类型">
                  <el-input
                    v-model="form_header.order.desc.direction_name"
                    disabled
                  ></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="5">
                <el-form-item label="客商">
                  <el-input
                    v-model="form_header.order.desc.customer_name"
                    disabled
                  ></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="5">
                <el-form-item label="原币币种">
                  <el-input
                    v-model="form_header.order.desc.currency_name"
                    disabled
                  ></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="5">
                <el-form-item label="原币金额">
                  <el-input
                    v-model="form_header.order.desc.original_price"
                    disabled
                  ></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="5">
                <el-form-item label="汇率">
                  <el-input
                    v-model="form_header.order.desc.exchange_rate"
                    disabled
                  ></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="5">
                <el-form-item label="本币金额">
                  <el-input
                    v-model="form_header.order.desc.currency_price"
                    disabled
                  ></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="5">
                <el-form-item label="已匹配金额">
                  <el-input
                    v-model="form_header.order.desc.matched_price"
                    disabled
                  ></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="5">
                <el-form-item label="未匹配金额">
                  <el-input
                    v-model="form_header.order.desc.unmatched_price"
                    disabled
                  ></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="2" style="margin-top:4px;">
                <el-button
                  type="primary"
                  size="small"
                  @click="
                    $router.push('/examine_historyss?id=' + form_header.id)
                  "
                >
                  <i class="fa fa-calendar-plus-o" aria-hidden="true"></i>
                  审批历史
                </el-button>
              </el-col>
            </el-row>
          </el-form>
          <el-table ref="xhzjData" :data="xhzjData" border style="width: 100%">
            <el-table-column label="资金类型" prop="cap_type_name">
            </el-table-column>
            <el-table-column label="敞口号" prop="exposure"> </el-table-column>
            <el-table-column label="敞口数量" prop="exp_vol"> </el-table-column>
            <el-table-column label="匹配金额" prop="alloc_amount">
            </el-table-column>
            <el-table-column label="备注" prop="remark"> </el-table-column>
          </el-table>
        </div>
        <div v-if="bol == 6">
          <el-form
            class="filter-container"
            ref="form_header"
            :model="form_header"
            label-width="100px"
          >
            <el-row :gutter="20">
              <el-col :span="5">
                <el-form-item label="部门名称">
                  <el-input
                    v-model="form_header.order.desc.department_name"
                    disabled
                  ></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="5">
                <el-form-item label="年度计划名称">
                  <el-input
                    v-model="form_header.order.desc.name"
                    disabled
                  ></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="5">
                <el-form-item label="年度计划年度">
                  <el-input
                    v-model="form_header.order.desc.plan_year"
                    disabled
                  ></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="5">
                <el-form-item label="开始日期">
                  <el-input
                    v-model="form_header.order.desc.start_date"
                    disabled
                  ></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="5">
                <el-form-item label="结束日期">
                  <el-input
                    v-model="form_header.order.desc.end_date"
                    disabled
                  ></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="5">
                <el-form-item label="备注">
                  <el-input
                    v-model="form_header.order.desc.remark"
                    disabled
                  ></el-input>
                </el-form-item>
              </el-col>
            </el-row>
          </el-form>
          <div style="margin-top:15px">
            <el-table
              ref="ndjhData"
              :data="ndjhData"
              border
              style="width: 100%"
            >
              <el-table-column label="现货品种" prop="commodity_name">
              </el-table-column>
              <el-table-column label="统计维度" prop="dimension_name">
              </el-table-column>
              <el-table-column
                label="现货经营总规模"
                prop="spot_management_scale"
              >
              </el-table-column>
              <el-table-column label="现货保值总规模" prop="spot_value_scale">
              </el-table-column>
              <el-table-column label="期货品种" prop="product_name">
              </el-table-column>
              <el-table-column label="套保比例" prop="hedge_ratio">
              </el-table-column>
              <el-table-column label="保证金规模" prop="margin_scale">
              </el-table-column>
              <el-table-column
                label="衍生品止损规模"
                prop="derivative_stop_scale"
              >
              </el-table-column>
              <el-table-column label="单位" prop="unit_name"> </el-table-column>
              <el-table-column label="币种" prop="currency_name">
              </el-table-column>
            </el-table>
          </div>
        </div>
      </el-card>
      <!-- <el-card shadow="never" class="d2-mb titleline">
        <el-form
          class="filter-container"
          ref="egForm"
          :model="egForm"
          label-width="70px"
        >
          <el-row :gutter="20">
            <el-col :span="24">
              <el-form-item label="审批意见">
                <el-input type="textarea" v-model="valueData"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-form-item>
            <el-button type="primary" size="small" @click="handleEdit_spty">
              <i class="fa fa-calendar-plus-o" aria-hidden="true"></i> 同意
            </el-button>
            <el-button type="primary" size="small" @click="handleEdit_spbh">
              <i class="fa fa-calendar-plus-o" aria-hidden="true"></i> 驳回
            </el-button>
          </el-form-item>
        </el-form>
      </el-card> -->
    </el-dialog>
  </d2-container>
</template>

<script>
import {
  getWork_order,
  getUsers,
  getOrder_process_his,
  getFutures_command_info,
  getFutures_command_trade
} from "@/api/url";
import { tradeInfo, annualPlan } from "@/api/url_info";
import moment from "moment";
export default {
  data() {
    return {
      riskTjListData: [],
      handleFilter_editspclVisible: false,
      tableData: [],
      selectlistRow: [],
      rowNum: 1,
      input: "",
      dataform: {
        p: 1,
        count: 0,
        pageSize: 20,
        startDate: "",
        endDate: "",
        creator: "",
        result: ""
      },
      activeName: "first",
      status_data: [
        { label: "发起", value: 0 },
        { label: "已同意", value: 1 },
        { label: "已驳回", value: 2 },
        { label: "已退审", value: 3 },
        { label: "全部", value: "" }
      ],
      value: "",
      value1: "",
      valuedate: "",
      valuedate1: "",
      egForm: {},
      userData: [],
      form_header: {
        creator: {
          name: ""
        },
        order: {
          business_id: "",
          task: {
            name: "",
            code: ""
          },
          desc: {}
        }
      },
      bol: 0,
      yspData: [],
      zhioneData: [],
      zhitwoData: [],
      xhfyData: [],
      xhzjData: [],
      xianhuoData: [],
      qihuoData: [],
      ndjhData: [],
      qiquanStats: 0,
      SLGhide: true,
      onecreated_time: "",
      options1: [
        {
          value: "选项1",
          label: "黄金糕"
        },
        {
          value: "选项2",
          label: "双皮奶"
        },
        {
          value: "选项3",
          label: "蚵仔煎"
        },
        {
          value: "选项4",
          label: "龙须面"
        },
        {
          value: "选项5",
          label: "北京烤鸭"
        }
      ]
    };
  },
  created() {
    this.select_list();
    this.select_userData();
  },
  methods: {
    select_userData() {
      getUsers().then(res => {
        this.userData = res.result;
      });
    },
    select_list() {
      // getWork_order(this.dataform).then(res => {
      //   this.riskTjListData = res.result.results;
      //   this.dataform.count=res.result.count
      // });
      getOrder_process_his(this.dataform).then(res => {
        this.dataform.count = res.result.count;
        this.riskTjListData = res.result.results;
        this.riskTjListData.forEach(item => {
          item.result = this.status_data[item.result].label;
        });
      });
    },
    //   单选未选中提示
    openMessage() {
      this.$message({
        dangerouslyUseHTMLString: true,
        type: "error",
        message: "<strong>请选中你要选择的行，再进行操作！</strong>"
      });
    },
    // 单选
    handleCurrentshclChange(val) {
      this.currentRow = val;
    },
    // 选中查看详情
    handleEdit_sp() {
      if (this.currentRow === undefined) {
        this.openMessage();
      } else {
        this.currentRow.order.desc = JSON.parse(this.currentRow.order.desc);
        this.form_header = this.currentRow;
        console.log(this.currentRow);
        this.onecreated_time = moment(this.form_header.created_time).format(
          "YYYY-MM-DD HH:mm:ss"
        );
        this.handleFilter_editspclVisible = true;
        if (this.currentRow.order.task.code == "FCOST") {
          this.bol = 1;
          this.yspData = this.form_header.order.desc.futures_alloc_fee;
        } else if (this.currentRow.order.task.code == "ORDER") {
          this.bol = 2;
          var datsssssssss = {
            command_id: this.currentRow.order.desc.command_id
          };
          getFutures_command_info(datsssssssss).then(res => {
            this.zhioneData = res.result.results;
          });
          getFutures_command_trade(datsssssssss).then(res => {
            this.zhitwoData = res.result.results;
          });
        } else if (this.currentRow.order.task.code == "SCOST") {
          this.bol = 3;
          this.xhfyData = this.form_header.order.desc.spot_alloc_fee;
        } else if (this.currentRow.order.task.code == "SFUND") {
          this.bol = 4;
          this.xhzjData = this.form_header.order.desc.spot_alloc_cap;
        } else if (this.currentRow.order.task.code == "YPLAN") {
          this.bol = 6;
          var plan_id = {
            id: this.currentRow.order.desc.id
          };
          annualPlan(plan_id).then(res => {
            this.ndjhData = res.result.results[0].annual_plan_details_info;
          });
        } else if (this.currentRow.order.task.code == "SLG") {
          // 偷个懒 如果长度为0就不显示
          // if(this.form_header.order.desc.strategy_type=='期货单边'){
          //   this.SLGhide=false
          // }
          this.bol = 5;
          let datte = {
            strategy_id: this.form_header.order.desc.strategy_id
          };
          tradeInfo(datte).then(res => {
            let oneData = [];
            let twoDate = [];
            res.result.forEach(item => {
              if (item.type == "现货") {
                oneData.push(item);
              } else {
                twoDate.push(item);
              }
            });
            this.xianhuoData = oneData;
            this.qihuoData = twoDate;
            this.qihuoData.forEach(items => {
              if (items.type == "期权") {
                this.qiquanStats = 1;
              }
            });
          });
        }
      }
    },
    // 审批驳回
    handleEdit_spbh() {},
    // 审批同意
    handleEdit_spty() {},
    //分页
    handlePaginationChange(val) {
      this.dataform.p = val;
      this.select_list();
    },
    chaxun_fn() {
      this.dataform.p = 1;
      this.select_list();
    },
    guanbi() {
      if (this.currentRow != null) {
        this.currentRow.desc = JSON.stringify(this.currentRow.desc);
      }
    }
  }
};
</script>
